/**
 * 
 */
package com.mrroman.linksender.gui;

import java.text.SimpleDateFormat;

import com.mrroman.linksender.sender.Message;
import com.mrroman.linksender.sender.MessageEvent;
import com.mrroman.linksender.sender.MessageListener;

/**
 * @author mrozekon
 *
 */
public class StackPopups implements MessageListener {

	/* (non-Javadoc)
	 * @see com.mrroman.linksender.sender.MessageListener#messageSend(com.mrroman.linksender.sender.MessageEvent)
	 */
	@Override
	public void messageSend(MessageEvent event) {
		Message msg = event.getMessage();
		
		MessagePopup.showPopup(
				"<b>" + msg.getSender() + "</b> " +
				"<i>" + 
				SimpleDateFormat.getDateTimeInstance().format(msg.getDate()) +
				"</i>" +
				": " +  msg.getMessage());
	}

	/* (non-Javadoc)
	 * @see com.mrroman.linksender.sender.MessageListener#serverInfo(com.mrroman.linksender.sender.MessageEvent)
	 */
	@Override
	public void serverInfo(MessageEvent event) {
		Message msg = event.getMessage();
		
		MessagePopup.showPopup("<h3>Error</h3>" +  msg.getMessage());
	}

}
